import React from 'react'
import { Button, Tag } from 'antd'
import ProTable from '@ant-design/pro-table'
import request from '@/utils/request'
export default () => {


    const columns: any = [
        {
            title: '用户名',
            dataIndex: 'store_title'
        },
        {
            title: '用户组',
            dataIndex: 'store_user_name',
            hideInSearch: true,
        },
        {
            title: '最后登录ip',
            dataIndex: 'level_title',
            hideInSearch: true,
            render: (text: any) => <Tag color="cyan">{text}</Tag>
        },
        {
            title: '最后登录时间',
            dataIndex: 'updated_at',
            hideInSearch: true,
        },
        {
            title: '用户状态',
            dataIndex: 'is_own',
            hideInSearch: true,
            width: "100px",
            align: "center",
            render: (text: any) => <Tag color={text ? "blue" : "red"}>{text ? "是" : "否"}</Tag>
        },

        {
            title: '操作',
            align: "center",
            width: "240px",
            render: (text: any, record: any) => (
                <>
                    <Button size="small" onClick={() => {

                    }} >编辑</Button>
                    <Button size="small" danger style={{ margin: "0 5px" }} onClick={() => {

                    }}>删除</Button>

                    <Button size="small" type="primary" onClick={() => {

                    }}>重置密码</Button>
                </>
            ),
        },
    ];
    return (

        <ProTable<any>
            toolBarRender={(action, { selectedRows }) => [
                <Button type="primary" onClick={() => {

                }}>
                    添加用户
            </Button>
            ]}
            headerTitle={null}
            rowKey="id"
            rowSelection={false}
            columns={columns}
            tableAlertRender={false}
            request={(params: any) => request('/store/list', {
                params,
            })}
        />
    )
}